//
//  WATFResultViewController.swift
//  WiFiFaster
//
//  Created by one on 2023/12/28.
//

import UIKit

class WATFResultViewController: WATFBaseCollectionViewController {
    init(watf_resultModel: Any? = nil, watf_funcModel: WATFFuncModel? = nil) {
        super.init(nibName: nil, bundle: nil)
        WATFManager.watf_manager.watf_testAdWork = false
        self.watf_resultModel = watf_resultModel
        self.watf_funcModel = watf_funcModel
        self.watf_funcModel?.watf_complete = true
        guard let watf_funcModel = watf_funcModel else { return  }
        let watf_count =  WATFManager.watf_manager.watf_getIntValue(watf_key: watf_funcModel.watf_title)
        WATFManager.watf_manager.watf_saveIntKey(watf_key: watf_funcModel.watf_title, watf_value: watf_count + 1)
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    override func viewDidLoad() {
       
        super.viewDidLoad()
        watf_navView.watf_titleLabel.text = watf_funcModel?.watf_type.watf_title
    }
    
    // MARK: - watf action
    override func watf_collectionViews() {
        view.addSubview(watf_navView)
        watf_contentView.addSubview(watf_collectionView)
    }
    // MARK: - watf lazy
    var watf_resultModel: Any?
    lazy var watf_navView: WATFNavView = {
        let watf_navView = WATFNavView()
        watf_navView.watf_leftBlock = {[weak self] in
            if let watf_vcs = self?.navigationController?.children {
                for watf_vc in watf_vcs {
                    if watf_vc.isMember(of: WATFSettingViewController.classForCoder()) {
                        self?.navigationController?.popToViewController(watf_vc, animated: true)
                        return
                    }
                }
            }
            self?.navigationController?.popToRootViewController(animated: true)
        }
        return watf_navView
    }()

}
